import React from 'react';
import { Router } from 'dva/router';
import App from "./pages/App.js";
import Constants from './utils/Constants';
import MenuConstants from './utils/MenuConstants';

const cached = {};
function registerModel(app, model) {
    if (!cached[model.namespace]) {
        app.model(model);
        cached[model.namespace] = 1;
    }
}

function RouterConfig({ history, app }) {
    const routes = [
        {
            path: '/',
            component: App,
            childRoutes: [
                {
                    path: MenuConstants.WORKBENCH[0],
                    name: MenuConstants.WORKBENCH[1],
                    childRoutes: [
                        {
                            path: MenuConstants.WORKBENCH[2].MESSAGECENTER[0],
                            name: MenuConstants.WORKBENCH[2].MESSAGECENTER[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/workbench/messageCenter').default)
                                    cb(null, require('./pages/workbench/messageCenter').default);
                                });
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.COMPANYMANAGE[0],
                    name: MenuConstants.COMPANYMANAGE[1],
                    childRoutes: [
                        {
                            path: MenuConstants.COMPANYMANAGE[2].BUSINESSPOOL[0],
                            name: MenuConstants.COMPANYMANAGE[2].BUSINESSPOOL[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/market/market').default)
                                    cb(null, require('./pages/company/businessPool').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.COMPANYMANAGE[2].INTENDEDCOMPANY[0],
                            name: MenuConstants.COMPANYMANAGE[2].INTENDEDCOMPANY[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/market/market').default)
                                    cb(null, require('./pages/company/intendedCompany').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.COMPANYMANAGE[2].DEALTCOMPANY[0],
                            name: MenuConstants.COMPANYMANAGE[2].DEALTCOMPANY[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/market/market').default)
                                    cb(null, require('./pages/company/dealtCompany').default);
                                })
                            }
                        },
                        {
                            path: MenuConstants.COMPANYMANAGE[2].MARKETINFO[0],
                            name: MenuConstants.COMPANYMANAGE[2].MARKETINFO[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/market/market').default)
                                    cb(null, require('./pages/company/marketInfo').default);
                                })
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.AUTH[0],
                    name: MenuConstants.AUTH[1],
                    childRoutes: [
                        {
                            path: 'user',
                            name: '用户管理',
                            path: MenuConstants.AUTH[2].USER[0],
                            name: MenuConstants.AUTH[2].USER[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/user').default)
                                    registerModel(app, require('./models/auth/organization').default)
                                    registerModel(app, require('./models/auth/role').default)
                                    cb(null, require('./pages/auth/user').default);
                                })
                            }
                        },
                        {
                            path: MenuConstants.AUTH[2].MENU[0],
                            name: MenuConstants.AUTH[2].MENU[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/menu').default);
                                    registerModel(app, require('./models/auth/rights').default);
                                    cb(null, require('./pages/auth/menu').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.AUTH[2].RIGHTS[0],
                            name: MenuConstants.AUTH[2].RIGHTS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/rights').default);
                                    cb(null, require('./pages/auth/rights').default);
                                })
                            }
                        },
                        {
                            path: MenuConstants.AUTH[2].LESSEE[0],
                            name: MenuConstants.AUTH[2].LESSEE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/lessee').default)
                                    cb(null, require('./pages/auth/lessee').default);
                                })
                            }
                        },
                        {
                            path: MenuConstants.AUTH[2].ROLE[0],
                            name: MenuConstants.AUTH[2].ROLE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/role').default);
                                    registerModel(app, require('./models/auth/menu').default);
                                    registerModel(app, require('./models/auth/rights').default);
                                    cb(null, require('./pages/auth/role').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.AUTH[2].ORGANIZATION[0],
                            name: MenuConstants.AUTH[2].ORGANIZATION[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/auth/organization').default);
                                    cb(null, require('./pages/auth/organization').default);
                                });
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.QUOTATIONSUPPORT[0],
                    name: MenuConstants.QUOTATIONSUPPORT[1],
                    childRoutes: [
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].CURRENCYRATE[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].CURRENCYRATE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/currencyRate').default)
                                    cb(null, require('./pages/quotationSupport/currencyRate').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].AIRLINE[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].AIRLINE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/airline').default)
                                    cb(null, require('./pages/quotationSupport/airline').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].BERTHINGCOMPANY[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].BERTHINGCOMPANY[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    cb(null, require('./pages/quotationSupport/berthingCompany').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].PORT[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].PORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/port').default)
                                    cb(null, require('./pages/quotationSupport/port').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].INCIDENTALS[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].INCIDENTALS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/incidentals').default)
                                    cb(null, require('./pages/quotationSupport/incidentals').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].FEEITEM[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].FEEITEM[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/feeItem').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    cb(null, require('./pages/quotationSupport/feeItem').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].WHARF[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].WHARF[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/wharf').default);
                                    cb(null, require('./pages/quotationSupport/wharf').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].AIRCOMPANY[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].AIRCOMPANY[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/airCompany').default)
                                    cb(null, require('./pages/quotationSupport/airCompany').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATIONSUPPORT[2].CHARGETEMPLATE[0],
                            name: MenuConstants.QUOTATIONSUPPORT[2].CHARGETEMPLATE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotationSupport/chargeTemplate').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/fee/localFeeDetail').default)
                                    registerModel(app, require('./models/logisticsOrder/orderCharge').default)
                                    cb(null, require('./pages/quotationSupport/chargeTemplate').default);
                                });
                            }
                        },
                    ]
                },
                {
                    path: MenuConstants.PROFIT[0],
                    name: MenuConstants.PROFIT[1],
                    childRoutes: [
                        {
                            path: 'declare',
                            name: '报关利润',
                            path: MenuConstants.PROFIT[2].DECLARE[0],
                            name: MenuConstants.PROFIT[2].DECLARE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profit/profit').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    cb(null, require('./pages/profit/declareProfit').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFIT[2].TRAILER[0],
                            name: MenuConstants.PROFIT[2].TRAILER[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profit/profit').default);
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    cb(null, require('./pages/profit/trailerProfit').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFIT[2].FREIGHT[0],
                            name: MenuConstants.PROFIT[2].FREIGHT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profit/profit').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/airline').default)
                                    registerModel(app, require('./models/logisticsOrder/trailer').default)
                                    cb(null, require('./pages/profit/freightProfit').default);
                                });
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.SUPPLIERMANAGE[0],
                    name: MenuConstants.SUPPLIERMANAGE[1],
                    childRoutes: [
                        {
                            path: MenuConstants.SUPPLIERMANAGE[2].SUPPLIERS[0],
                            name: MenuConstants.SUPPLIERMANAGE[2].SUPPLIERS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    cb(null, require('./pages/supplier/supplier').default);
                                });
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.COSTMAINTENANCE[0],
                    name: MenuConstants.COSTMAINTENANCE[1],
                    childRoutes: [
                        {
                            path: MenuConstants.COSTMAINTENANCE[2].DECLAREFEE[0],
                            name: MenuConstants.COSTMAINTENANCE[2].DECLAREFEE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/fee/declareFee').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    cb(null, require('./pages/fee/declareFee').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.COSTMAINTENANCE[2].SUPPLIERFARE[0],
                            name: MenuConstants.COSTMAINTENANCE[2].SUPPLIERFARE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/fee/freightFee').default);
                                    // registerModel(app, require('./models/fee/localFee').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    registerModel(app, require('./models/quotationSupport/airline').default);
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default);
                                    registerModel(app, require('./models/quotationSupport/feeItem').default);
                                    cb(null, require('./pages/fee/freightFee').default);
                                });
                            }
                        },
                        // {
                        //     path: 'supplierProfit',
                        //     name:'供应商费用利润',
                        //     getComponent(nextState, cb){
                        //         require.ensure([],(require) =>{
                        //             registerModel(app, require('./models/supplier/supplierProfit').default);
                        //             registerModel(app, require('./models/supplier/supplier').default);
                        //             cb(null, require('./pages/supplier/supplierProfit').default);
                        //         });
                        //     }
                        // },
                        {
                            path: MenuConstants.COSTMAINTENANCE[2].TRAILERFEE[0],
                            name: MenuConstants.COSTMAINTENANCE[2].TRAILERFEE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/fee/trailerFee').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    cb(null, require('./pages/fee/trailerFee').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.COSTMAINTENANCE[2].LOCALFEE[0],
                            name: MenuConstants.COSTMAINTENANCE[2].LOCALFEE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/fee/localFee').default);
                                    registerModel(app, require('./models/fee/localFeeDetail').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    registerModel(app, require('./models/quotationSupport/airline').default);
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default);
                                    registerModel(app, require('./models/quotationSupport/feeItem').default);
                                    cb(null, require('./pages/fee/localFee').default);
                                });
                            }
                        }
                    ]
                },
                {
                    path: MenuConstants.QUOTATION[0],
                    name: MenuConstants.QUOTATION[1],
                    childRoutes: [
                        {
                            path: MenuConstants.QUOTATION[2].QUOTATIONFEE[0],
                            name: MenuConstants.QUOTATION[2].QUOTATIONFEE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/quotationSupport/currencyRate').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/incidentals').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    cb(null, require('./pages/quotation/quotationFee').default);
                                });
                            }
                        },
                        {
                            path: MenuConstants.QUOTATION[2].QUOTATIONRECORD[0],
                            name: MenuConstants.QUOTATION[2].QUOTATIONRECORD[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/quotationSupport/currencyRate').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/incidentals').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/logisticsOrder/deliveryReceipt').default)
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/quotationSupport/chargeTemplate').default)
                                    cb(null, require('./pages/quotation/quotationRecord').default);
                                });
                            },

                        }
                    ]
                },
                {
                    path: MenuConstants.LOGISTICSORDER[0],
                    name: MenuConstants.LOGISTICSORDER[1],
                    childRoutes: [
                        {
                            path: MenuConstants.LOGISTICSORDER[2].DELIVERYRECEIPT[0],
                            name: MenuConstants.LOGISTICSORDER[2].DELIVERYRECEIPT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/deliveryReceipt').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/quotationSupport/airCompany').default)
                                    cb(null, require('./pages/logisticsOrder/deliveryReceipt').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].ACCEPTORDERS[0],
                            name: MenuConstants.LOGISTICSORDER[2].ACCEPTORDERS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/deliveryReceipt').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/quotationSupport/airCompany').default)
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    cb(null, require('./pages/logisticsOrder/acceptOrders').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].QUICKBOOKING[0],
                            name: MenuConstants.LOGISTICSORDER[2].QUICKBOOKING[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    cb(null, require('./pages/logisticsOrder/quickBooking').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].ORDERQUERYOPE[0],
                            name: MenuConstants.LOGISTICSORDER[2].ORDERQUERYOPE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/logisticsOrder/deliveryReceipt').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/quotationSupport/airCompany').default)
                                    registerModel(app, require('./models/logisticsOrder/orderCharge').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/approval/approvalHistory').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/logisticsOrder/payment').default)
                                    registerModel(app, require('./models/logisticsOrder/revenue').default)
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/quotationSupport/chargeTemplate').default)
                                    cb(null, require('./pages/logisticsOrder/order').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].REVENUE[0],
                            name: MenuConstants.LOGISTICSORDER[2].REVENUE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/revenue').default)
                                    registerModel(app, require('./models/history/history').default)
                                    cb(null, require('./pages/logisticsOrder/revenue').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].ORDERQUERYBUS[0],
                            name: MenuConstants.LOGISTICSORDER[2].ORDERQUERYBUS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/deliveryReceipt').default)
                                    registerModel(app, require('./models/quotation/quotationRecord').default)
                                    registerModel(app, require('./models/company/company').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/logisticsOrder/order').default)
                                    registerModel(app, require('./models/logisticsOrder/orderCharge').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/approval/approvalHistory').default)
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/logisticsOrder/payment').default)
                                    registerModel(app, require('./models/quotation/quotationFee').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/quotationSupport/airCompany').default)
                                    registerModel(app, require('./models/quotationSupport/chargeTemplate').default)
                                    cb(null, require('./pages/logisticsOrder/orderBusiness').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.LOGISTICSORDER[2].BATCHVERIFICATE[0],
                            name: MenuConstants.LOGISTICSORDER[2].BATCHVERIFICATE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/orderCharge').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default);
                                    registerModel(app, require('./models/logisticsOrder/payment').default);
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    registerModel(app, require('./models/quotationSupport/chargeTemplate').default)
                                    cb(null, require('./pages/batchVerificate/batchVerificate').default)
                                })
                            }
                        },

                        {
                            path: MenuConstants.LOGISTICSORDER[2].ONLINEBOOKING[0],
                            name: MenuConstants.LOGISTICSORDER[2].ONLINEBOOKING[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    cb(null, require('./pages/logisticsOrder/onlineBooking').default)
                                })
                            }
                        },


                        {
                            path: MenuConstants.LOGISTICSORDER[2].TRAILER[0],
                            name: MenuConstants.LOGISTICSORDER[2].TRAILER[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/quickBooking').default)
                                    registerModel(app, require('./models/supplier/supplier').default)
                                    registerModel(app, require('./models/quotationSupport/berthingCompany').default)
                                    registerModel(app, require('./models/logisticsOrder/trailer').default)

                                    cb(null, require('./pages/logisticsOrder/trailer').default)
                                })
                            }
                        },



                    ]
                },
                {
                    path: MenuConstants.FINANCE[0],
                    name: MenuConstants.FINANCE[1],
                    childRoutes: [
                        {
                            path: MenuConstants.FINANCE[2].REVENUE[0],
                            name: MenuConstants.FINANCE[2].REVENUE[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/revenue').default)
                                    registerModel(app, require('./models/history/history').default)
                                    cb(null, require('./pages/finance/revenue').default)
                                })
                            }
                        },
                        {
                            path: MenuConstants.FINANCE[2].PAYMENT[0],
                            name: MenuConstants.FINANCE[2].PAYMENT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/logisticsOrder/payment').default)
                                    registerModel(app, require('./models/logisticsOrder/revenue').default)
                                    registerModel(app, require('./models/logisticsOrder/orderCharge').default)
                                    registerModel(app, require('./models/quotationSupport/feeItem').default)
                                    registerModel(app, require('./models/history/history').default)
                                    registerModel(app, require('./models/supplier/supplier').default);
                                    cb(null, require('./pages/finance/payment').default)
                                })
                            }
                        },
                    ]
                },
                {
                    path: MenuConstants.PROFITREPORT[0],
                    name: MenuConstants.PROFITREPORT[1],
                    childRoutes: [
                        {
                            path: MenuConstants.PROFITREPORT[2].STATISTICSREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].STATISTICSREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/statisticsReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].YWUSERYEARREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].YWUSERYEARREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/ywUserYearReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].CSTYEARREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].CSTYEARREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/cstYearReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].RECEIPTSTATISTICSREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].RECEIPTSTATISTICSREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/receiptStatisticsReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].REVENUESTATISTICSREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].REVENUESTATISTICSREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/revenueStatisticsReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].PAYSTATISTICSREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].PAYSTATISTICSREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/payStatisticsReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].FINANCESTATISTICSREPORT[0],
                            name: MenuConstants.PROFITREPORT[2].FINANCESTATISTICSREPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/financeStatisticsReport').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].CURRENCYPROFITSTATISTICS[0],
                            name: MenuConstants.PROFITREPORT[2].CURRENCYPROFITSTATISTICS[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/currencyProfitStatistics').default)
                                });
                            }
                        },
                        {
                            path: MenuConstants.PROFITREPORT[2].MARKET_INFO_REPORT[0],
                            name: MenuConstants.PROFITREPORT[2].MARKET_INFO_REPORT[1],
                            getComponent(nextState, cb) {
                                require.ensure([], (require) => {
                                    registerModel(app, require('./models/profitReport/report').default)
                                    cb(null, require('./pages/profitReport/marketReport').default)
                                });
                            }
                        }
                    ]
                },
            ]
        },
        {
            path: '/login',
            name: '登录页面',
            getComponent(nextState, cb) {
                require.ensure([], (require) => {
                    registerModel(app, require('./models/auth/login').default)
                    cb(null, require('./pages/auth/login').default);
                });
            }
        },
        {
            path: '/logout'
        },
        {
            path: 'notAuthorized',
            getComponent(nextState, cb) {
                require.ensure([], (require) => {
                    cb(null, require('./pages/notAuthorized').default);
                });
            }
        },
        {
            path: '*',
            getComponent(nextState, cb) {
                require.ensure([], (require) => {
                    cb(null, require('./pages/404').default);
                });
            }
        },
    ];
    return <Router history={history} routes={routes} />;
}

export default RouterConfig;
